﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LuceneDemo.Extension
{
    public static class IntentScoreExtensions
    {
        public static IEnumerable<IntentScore> ResetScore(this IEnumerable<IntentScore> intentScores, float maxScore)
        {
            if (intentScores != null)
            {
                foreach (var intentScore in intentScores)
                {
                    intentScore.Score = intentScore.Score >= maxScore ? 100f : (100f * intentScore.Score / maxScore);
                }

                return intentScores;
            }

            return null;
        }
    }
}
